import store from '@/store'
const columnsConfig = ['selection','operation'
    ,'sid'
    ,'tradeCode'
    ,'tradeName'
    ,'emsNo'
    ,'emsListNo'
    ,'billListNo'
    ,'listNo'
    ,'agentCode'
    ,'agentCodeCiq'
    ,'agentCreditCode'
    ,'agentName'
    ,'billNo'
    ,'businessType'
    ,'changeTimes'
    ,'classifyReason'
    ,'classifyTime'
    ,'classifyType'
    ,'confirmPrice'
    ,'confirmRoyalties'
    ,'confirmSpecial'
    ,'contrNo'
    ,'cutMode'
    ,'dataSource'
    ,'dclcusMark'
    ,'dclcusType'
    ,'declCustoms'
    ,'declareChannel'
    ,'declareCode'
    ,'declareCreditCode'
    ,'declareDate'
    ,'declareName'
    ,'declareType'
    ,'despPort'
    ,'destPort'
    ,'duCode'
    ,'dutySelf'
    ,'entryDeclareDate'
    ,'entryMessageId'
    ,'entryNo'
    ,'entryPort'
    ,'entryStatus'
    ,'entryType'
    ,'errorMsg'
    ,'feeCurr'
    ,'feeMark'
    ,'feeRate'
    ,'feeRateNote'
    ,'flag'
    ,'formalVrfdedDate'
    ,'gMark'
    ,'grossWt'
    ,'iEDate'
    ,'iEMark'
    ,'iEPort'
    ,'icCardNo'
    ,'indbTime'
    ,'inputCode'
    ,'inputCreditCode'
    ,'inputDate'
    ,'inputName'
    ,'insertTime'
    ,'insertUser'
    ,'insurCurr'
    ,'insurMark'
    ,'insurRate'
    ,'insurRateNote'
    ,'itemCnt'
    ,'licenseNo'
    ,'listIochkptStatus'
    ,'listType'
    ,'masterCustoms'
    ,'mergeType'
    ,'messageId'
    ,'netWt'
    ,'note'
    ,'note1'
    ,'note2'
    ,'note3'
    ,'oriBillListNo'
    ,'otherCurr'
    ,'otherMark'
    ,'otherRate'
    ,'otherRateNote'
    ,'overseasShipperAeo'
    ,'overseasShipperName'
    ,'packNum'
    ,'passportUsedMark'
    ,'preSeqNo'
    ,'preVrfdedDate'
    ,'receiveCode'
    ,'receiveCodeCiq'
    ,'receiveCreditCode'
    ,'receiveName'
    ,'relEmsNo'
    ,'relEntryDeclareCode'
    ,'relEntryDeclareCreditCode'
    ,'relEntryDeclareName'
    ,'relEntryNo'
    ,'relEntryReceiveCode'
    ,'relEntryReceiveCreditCode'
    ,'relEntryReceiveName'
    ,'relEntryTradeCode'
    ,'relEntryTradeCreditCode'
    ,'relEntryTradeName'
    ,'relListNo'
    ,'rotateApplyNo'
    ,'rotateType'
    ,'sendUser'
    ,'seqNo'
    ,'status'
    ,'tradeCodeCiq'
    ,'tradeCountry'
    ,'tradeCreditCode'
    ,'tradeMode'
    ,'tradeNation'
    ,'trafMode'
    ,'trafName'
    ,'transMode'
    ,'updateTime'
    ,'updateUser'
    ,'voyageNo'
    ,'vrfdedMark'
    ,'vrfdedMode'
    ,'warehouse'
    ,'wrapType'
]
const excelColumnsConfig = [
    'sid',
    'tradeCode',
    'tradeName',
    'emsNo',
    'emsListNo',
    'billListNo',
    'listNo',
    'agentCode',
    'agentCodeCiq',
    'agentCreditCode',
    'agentName',
    'billNo',
    'businessType',
    'changeTimes',
    'classifyReason',
    'classifyTime',
    'classifyType',
    'confirmPrice',
    'confirmRoyalties',
    'confirmSpecial',
    'contrNo',
    'cutMode',
    'dataSource',
    'dclcusMark',
    'dclcusType',
    'declCustoms',
    'declareChannel',
    'declareCode',
    'declareCreditCode',
    'declareDate',
    'declareName',
    'declareType',
    'despPort',
    'destPort',
    'duCode',
    'dutySelf',
    'entryDeclareDate',
    'entryMessageId',
    'entryNo',
    'entryPort',
    'entryStatus',
    'entryType',
    'errorMsg',
    'feeCurr',
    'feeMark',
    'feeRate',
    'feeRateNote',
    'flag',
    'formalVrfdedDate',
    'gMark',
    'grossWt',
    'iEDate',
    'iEMark',
    'iEPort',
    'icCardNo',
    'indbTime',
    'inputCode',
    'inputCreditCode',
    'inputDate',
    'inputName',
    'insertTime',
    'insertUser',
    'insurCurr',
    'insurMark',
    'insurRate',
    'insurRateNote',
    'itemCnt',
    'licenseNo',
    'listIochkptStatus',
    'listType',
    'masterCustoms',
    'mergeType',
    'messageId',
    'netWt',
    'note',
    'note1',
    'note2',
    'note3',
    'oriBillListNo',
    'otherCurr',
    'otherMark',
    'otherRate',
    'otherRateNote',
    'overseasShipperAeo',
    'overseasShipperName',
    'packNum',
    'passportUsedMark',
    'preSeqNo',
    'preVrfdedDate',
    'receiveCode',
    'receiveCodeCiq',
    'receiveCreditCode',
    'receiveName',
    'relEmsNo',
    'relEntryDeclareCode',
    'relEntryDeclareCreditCode',
    'relEntryDeclareName',
    'relEntryNo',
    'relEntryReceiveCode',
    'relEntryReceiveCreditCode',
    'relEntryReceiveName',
    'relEntryTradeCode',
    'relEntryTradeCreditCode',
    'relEntryTradeName',
    'relListNo',
    'rotateApplyNo',
    'rotateType',
    'sendUser',
    'seqNo',
    'status',
    'tradeCodeCiq',
    'tradeCountry',
    'tradeCreditCode',
    'tradeMode',
    'tradeNation',
    'trafMode',
    'trafName',
    'transMode',
    'updateTime',
    'updateUser',
    'voyageNo',
    'vrfdedMark',
    'vrfdedMode',
    'warehouse',
    'wrapType',
  ]
const declareType={
      '1':'清单审批',
      '2':'清单修改',
      '3':'清单删除',
      '4':'清单同步'
}
const entryType={
  'P':'出口提前/工厂验放备案清单',
  'I':'进口提前/暂时进口报关单',
  'J':'出口提前/暂时出口报关单',
  'K':'进口提前/中欧班列报关单',
  'L':'出口提前/中欧班列报关单',
  'M':'出口提前/市场采购报关单',
  'N':'出口提前/空运联程报关单',
  'O':'进口提前/工厂验放备案清单',
  '9':'转关提前进口报关单',
  'A':'转关提前出口报关单',
  'B':'转关提前进境备案清单',
  'e':'进口两步申报一次录入报关单',
  'f':'进口两步申报一次录入备案清单',
  'Q':'进口提前/暂时进口备案清单',
  'X':'进口两步申报报关单',
  'Y':'进口两步申报备案清单',
  '1':'进口报关单',
  '2':'出口报关单',
  '3':'进境备案清单',
  '4':'出境备案清单',
  '5':'进境两单一审备案清单',
  '6':'出境两单一审备案清单',
  'C':'转关提前出境备案清单',
  'F':'出口二次转关',
  'G':'进口提前/工厂验放报关单',
  'H':'出口提前/工厂验放报关单'
}
const listType={
  '0':'普通清单',
  '9':'一纳成品内销',
  '6':'区内流转',
  '1':'分送集报',
  '5':'保税展示交易',
  '4':'简单加工',
  '3':'退单1',
  '8':'保税电商',
  '7':'区港联动'
}
const columns = {
  data() {
    return {
      totalColumns: [
        {
          type: 'selection',
          width: 60,
          align: 'center',
          key: 'selection',
        },
        {
          title: '操作',
          width: 120,
          align: 'center',
          render: (h,params) => {
            return h('div', [
              h('a', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  marginRight: '15px'
                },
                on: {
                  click: () => {
                    this.gridConfig.selectData = params.row
                    this.handleEdit()
                  }
                }
              }, '编辑'),
              //添加查看按钮
              h('a', {
                props: {
                  type: 'primary',
                },
                style: {},
                on: {
                  click: () => {
                    this.gridConfig.selectData = params.row
                    this.handleView()
                  },
                },
              }, '查看')
              ]);
          },
          key: 'operation'
        },
        {
          title: '企业内部编号',
          minWidth: 120,
          align: 'center',
          key: 'emsListNo',
        },
        {
          title: '清单流水号',
          minWidth: 120,
          align: 'center',
          key: 'billListNo',
        },
        {
          title: '核注清单编号',
          minWidth: 120,
          align: 'center',
          key: 'listNo',
        },
        {
          title: '清单归类原因',
          minWidth: 120,
          align: 'center',
          key: 'classifyReason',
        },
        {
          title: '清单归类时间',
          minWidth: 120,
          align: 'center',
          key: 'classifyTime',
          render: (h, params) => {
            return h('span', params.row.classifyTime ? params.row.classifyTime.slice(0, 10) : params.row.classifyTime)
          }
        },
        {
          title: '清单归类',
          minWidth: 120,
          align: 'center',
          key: 'classifyType',
        },
        {
          title: '合同协议号',
          minWidth: 120,
          align: 'center',
          key: 'contrNo',
        },
        {
          title: '报关标志',
          minWidth: 120,
          align: 'center',
          key: 'dclcusMark',
          //数字转成对应的文字
          render: (h, params) => {
            if (params.row.dclcusMark=='1'){
              return h('div','报关')
            }
            if (params.row.dclcusMark=='2') {
              return  h('div','非报关')
            }
          }
        },
        {
          title: '报关类型',
          minWidth: 120,
          align: 'center',
          key: 'dclcusType',
          render:(h,params)=>{
            if (params.row.dclcusType=='1'){
              return h('div','关联报关')
            }else {
              return  h('div','对应报关')
            }
          }
        },
        {
          title: '清单申报日期',
          minWidth: 120,
          align: 'center',
          key: 'declareDate',
          render: (h, params) => {
            return h('span', params.row.declareDate ? params.row.declareDate.slice(0, 10) : params.row.declareDate)
          }
        },
        {
          title: '申报类型',
          minWidth: 120,
          align: 'center',
          key: 'declareType',
          render: (h, params) => {
            return h('span', declareType[params.row.declareType])
          }
        },
        {
          title: '报关单申报日期',
          minWidth: 120,
          align: 'center',
          key: 'entryDeclareDate',
          render: (h, params) => {
            return h('span', params.row.entryDeclareDate ? params.row.entryDeclareDate.slice(0, 10) : params.row.entryDeclareDate)
          }
        },
        {
          title: '报关单编号',
          minWidth: 120,
          align: 'center',
          key: 'entryNo',
          render: (h, params) => {
            if (params.row.flag=='1'){
              return h('a',{
                on:{
                  click:()=>{alert('待开发功能!')}
                }
              },params.row.entryNo)
            }else {
              return h('div',params.row.entryNo)
            }
          }
        },
        {
          title: '报关状态',
          minWidth: 120,
          align: 'center',
          key: 'entryStatus',
          render:(h,params)=>{
            for (let i=0; i<store.state.entryStatus.length;i++){
              if (store.state.entryStatus[i].code==params.row.entryStatus){
                return h('div',[
                  h('a',{
                    on:{
                      click:()=>{
                        store.state.flag=params.row.flag
                        this.headId=params.row.sid
                        this.isShowStatic()
                      }
                    }
                  },store.state.entryStatus[i].name)
                ])
              }
            }
          }
        },
        {
          title: '报关单类型',
          minWidth: 120,
          align: 'center',
          key: 'entryType',
          render: (h, params) => {
            return h('span', entryType[params.row.entryType])
          }
        },
        {
          title: '料件成品标志',
          minWidth: 120,
          align: 'center',
          key: 'gMark',
          render:(h,params)=>{
            if (params.row.gMark=='I'){
              return h('div','料件')
            }else {
              return  h('div','成品')
            }
          }
        },
        {
          title: '进境关别/出境关别',
          minWidth: 120,
          align: 'center',
          key: 'iEPort',
          render: (h, params) => {
            return h('span', this.pcodeGet(this.pcode.customs_rel, params.row.iEPort))
          }
        },
        {
          title: '商品项数',
          minWidth: 120,
          align: 'center',
          key: 'itemCnt',
        },
        {
          title: '清单类型',
          minWidth: 120,
          align: 'center',
          key: 'listType',
          render: (h, params) => {
            return h('span', listType[params.row.listType])
          }
        },
        {
          title: '主管海关',
          minWidth: 120,
          align: 'center',
          key: 'masterCustoms',
          render: (h, params) => {
            return h('span', this.pcodeGet(this.pcode.customs_rel, params.row.masterCustoms))
          }
        },
        {
          title: '备注',
          minWidth: 120,
          align: 'center',
          key: 'note',
        },
        {
          title: '本地备注1',
          minWidth: 120,
          align: 'center',
          key: 'note1',
        },
        {
          title: '本地备注2',
          minWidth: 120,
          align: 'center',
          key: 'note2',
        },
        {
          title: '本地备注3',
          minWidth: 120,
          align: 'center',
          key: 'note3',
        },
        {
          title: '清单预录入统一编号',
          minWidth: 120,
          align: 'center',
          key: 'preSeqNo',
        },
        {
          title: '关联手(账)册编号',
          minWidth: 120,
          align: 'center',
          key: 'relEmsNo',
        },
        {
          title: '关联报关单申报单位编码',
          minWidth: 120,
          align: 'center',
          key: 'relEntryDeclareCode',
        },
        {
          title: '关联报关单申报单位名称',
          minWidth: 120,
          align: 'center',
          key: 'relEntryDeclareName',
        },
        {
          title: '关联核注清单编号',
          minWidth: 120,
          align: 'center',
          key: 'relListNo',
        },
        {
          title: '清单申报人',
          minWidth: 120,
          align: 'center',
          key: 'sendUser',
        },
        {
          title: '报关单统一编号',
          minWidth: 120,
          align: 'center',
          key: 'seqNo',
        },
        {
          title: '清单状态',
          minWidth: 120,
          align: 'center',
          key: 'status',
          render:(h,params)=>{
            for (let i=0; i<store.state.status.length;i++){
              if (store.state.status[i].code==params.row.status){
                return h('a',{
                  on:{
                    click:()=>{
                      store.state.flag=params.row.flag
                      this.headId=params.row.sid
                      this.isShowStatic()
                    }
                  }
                },store.state.status[i].name)
              }
            }
          },
        },
        {
          title: '启运国(地区)/运抵国(地区）',
          minWidth: 120,
          align: 'center',
          key: 'tradeCountry',
          render: (h, params) => {
            return h('span', this.pcodeGet(this.pcode.country_outdated, params.row.tradeCountry))
          }
        },
        {
          title: '监管方式',
          minWidth: 120,
          align: 'center',
          key: 'tradeMode',
          render: (h, params) => {
            return h('span', this.pcodeGet(this.pcode.trade, params.row.tradeMode))
          }
        },
        {
          title: '运输方式',
          minWidth: 120,
          align: 'center',
          key: 'trafMode',
          render: (h, params) => {
            return h('span', this.pcodeGet(this.pcode.transf, params.row.trafMode))
          }
        },
        {
          title: '录入日期',
          minWidth: 120,
          align: 'center',
          key: 'updateTime',
          render: (h, params) => {
            return h('span', params.row.updateTime ? params.row.updateTime.slice(0, 10) : params.row.updateTime)
          }
        },
        {
          title: '录入人',
          minWidth: 120,
          align: 'center',
          key: 'updateUser',
        },
        {
          title: '核扣标志',
          minWidth: 120,
          align: 'center',
          key: 'vrfdedMark',
          render: (h, params) => {
            for (let i=0; i<store.state.vrfdedMarkList.length;i++){
              if (store.state.vrfdedMarkList[i].code==params.row.vrfdedMark){
                return h('span', store.state.vrfdedMarkList[i].name)
              }
            }
          }
        },
      ]
    }
  }
}
export {
  columns,
  excelColumnsConfig,
  columnsConfig
}
